package io.coding.service;

import io.coding.dao.MessageBoardDao;
import io.coding.model.Bl_message_board;
import io.coding.utils.DateUtils;
import io.coding.utils.IoUtiles;
import io.coding.utils.JoddProrUtils;
import jodd.datetime.JDateTime;
import jodd.util.StringUtil;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.*;
import java.util.List;
import java.util.Random;
import java.util.TimeZone;

/**
 * Created by Administrator on 2014/9/10.
 */
@Service
public class MessageBoardService {

    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(JoddProrUtils.class);

    @Autowired
    MessageBoardDao messageBoardDao;
    public List<Bl_message_board> findAll(){
        return messageBoardDao.findAll();
    }

    public void AddMessageBoard(String content, String source_ip) {
        JDateTime jdt = new JDateTime();
        jdt.changeTimeZone(TimeZone.getTimeZone("GMT+8"));
        messageBoardDao.AddMessageBoard(content, StringUtil.isEmpty(source_ip) ? "未知地址" : source_ip, jdt.toString());
    }
}
